<?php
/**
 *Author:淡心心心
 *Date:2021/4/26
 *Time:19:54
 */
require_once "class/Common.php";

$common = new Common();
$wheather = $_POST['wheather'];
if($wheather==""){
    echo json_encode(['status'=>400,'msg'=>"城市不能为空"]);
    die();
}
$url = "https://restapi.amap.com/v3/weather/weatherInfo?key=5d2d3e6c0d5188bec134fc4fc1b139e0&city={$wheather}&extensions=base";
$data = $common->CurlHttp($url);
$dataarr = json_decode($data,1);
$lives = $dataarr["lives"][0];
$res = ['status'=>200,'tianqi'=>$lives['weather'],'wendu'=>$lives["temperature"]];
echo json_encode($res);
